import { request } from 'umi';
import {Params, KnowledgeListRequestParams, KnowledgeListResponse, KnowledgePublicListRequestParams} from './data.d';

export async function getTypeCount(options?: { [key: string]: any }) {
    return request<{
        data: any[];
    }>('/typeCount', {
        method: 'GET',
        ...(options || {}),
    });
}

export async function getTypes1(options?: { [key: string]: any }) {
    return request<{
        success: boolean;
        data: any[];
    }>('/types1', {
        method: 'GET',
        ...(options || {}),
    });
}

export async function getTypes2(options?: { [key: string]: any }) {
    return request<{
        success: boolean;
        data: any[];
    }>('/types2', {
        method: 'GET',
        ...(options || {}),
    });
}

// export async function queryFakeList(
//     params: Params,
// ): Promise<{ data: { list: ListItemDataType[] } }> {
//     return request('/aircaskb/knowledge/list', {
//         params,
//     });
// }

//获取知识列表
export async function queryFakeList(body: KnowledgeListRequestParams, options?: { [key: string]: any }){
    return request<AircasKB.ResponseType<KnowledgeListResponse>>(
        `/aircaskb/knowledge/list`,
        {
            method: 'POST',
            data:body,
            ...(options || {}),
        },
    );
}

//获取知识列表-用于知识库
export async function KnowledgePublicListRequest(body: KnowledgePublicListRequestParams, options?: { [key: string]: any }){
    return request<AircasKB.ResponseType<KnowledgeListResponse>>(
        `/aircaskb/knowledge/public/search`,
        {
            method: 'POST',
            data:body,
            ...(options || {}),
        },
    );
}

export async function queryKnowledgeStructures(params: Params): Promise<{ data: string[] }> {
    return request('/mockApi/structure', {
        params,
    });
}
